<@t.header> </@t.header> <@t.body>
<div class="navbar navbar-default navbar-fixed-top padding-0 margin-0">
	<div class="container-fluid">
		<div class="navbar-header">
			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#left-menu-collapse" aria-expanded="false">
				<span class="sr-only">Toggle navigation</span>
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
			</button>
			<a class="navbar-brand" href="#">项目管理系统</a>
		</div>
		<p class="navbar-text navbar-right hidden-xs">
			<a href="${request.contextPath}/logout" class="navbar-link">
				<i class="icon-signout"></i>
				退出
			</a>
			&nbsp;
		</p>
		<#if Session['sys_manager']>
		<p class="navbar-text navbar-right hidden-xs">
			<a href="${request.contextPath}/config/index" class="navbar-link">
				<i class="icon-leaf"></i>
				系统配置
			</a>
			&nbsp;
		</p>
		</#if>
	</div>
</div>

<div class="container-fluid left-menu padding-0">
	<div class="row margin-0 padding-0 hidden-xs">
		<div class="col-md-12 col-sm-12 col-xs-12 padding-0" style="font-size: 25px;">
			<div class="panel margin-0" style="border-bottom: 1px solid #ddd;">
				<table class="table">
					<tr>
						<td>
							<i class="icon-user text-primary"></i>
							${Session['login_user'].name}
							<i class="icon-cog user-config text-danger" style="font-size: 16px; cursor: pointer;" title="修改密码" data-user-id="${Session['login_user'].id}"></i>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</div>
	<div class="row margin-0 padding-0">
		<div class="col-md-12 col-sm-12 col-xs-12 padding-0">
			<div class="collapse navbar-collapse padding-0 left-tree-menu" id="left-menu-collapse"></div>
		</div>
	</div>
</div>

<div class="container-fluid index-container suredy-content"></div>
</@t.body> <@t.foot>
<script src="${request.contextPath}/core/js/jquery.form.js"></script>
<script src="${request.contextPath}/js/suredy-modal.js"></script>
<script src="${request.contextPath}/js/suredy-tree-menu.js"></script>
<script type="text/javascript">
	$(function() {
		$.ajax({
			url : '${request.contextPath}/config/menu/user',
			type : 'GET',
			dataType : 'json',
			success : function(data) {
				if (!data)
					return;

				if ($.isArray(data) && data.length <= 0)
					return;

				$('.left-tree-menu').treeMenu(data, {
					autoCollapse : true
				});
			},
			error : function() {

			}
		});

		$('.user-config').on('click', function() {
			var $this = $(this);
			$.suredy.showModal({
				title : '修改信息',
				okText : '确定',
				cancelText : '关闭',
				uri : '${request.contextPath}/config/user/user-config',
				okClick : function() {
					var form = $('form#user-config-form');
					var pswd = $('input[name="pswd"]', form);
					var repeat = $('input#repeat', form);

					if (!pswd.val() || !repeat.val()) {
						alert('请正确填写信息');
						return false;
					}

					if (pswd.val() !== repeat.val()) {
						alert('两次输入的密码不一致！');
						return false;
					}

					form.ajaxSubmit({
						url : '${request.contextPath}/config/user/user-config',
						type : 'POST',
						dataType : 'json',
						success : function(data) {
							if (!data) {
								alert('修改失败！');
							} else {
								alert('修改成功');
								$.suredy.closeModal();
							}
						},
						error : function(jqXHR, textStatus, errorThrown) {
							alert('修改失败！\n' + errorThrown);
						}
					});

					return false;
				}
			});
		});
	});
</script>
</@t.foot>
